#ifndef SNTP_API_H__
#define SNTP_API_H__

#include "user_extern.h"
#include "lwip/apps/sntp.h"

typedef struct _mtime
{
    uint8_t sntp_syn; /* 是否已经sntp同步标志位 */
    struct tm g_time;
    struct tm g_alarm[2];
    uint8_t g_alarm_ring; /* 闹钟是否在响 */
    time_t g_timestamp;   /* 全局时间戳 */

    void (*msntp_init)(void);
    void (*mtime_config)(struct tm *g_time);
    void (*tstamp_to_ltime)(void);
    void (*ltime_to_tstamp)(void);

    void (*add_alarm)(void);
    void (*delete_alarm)(void);

} Mtime;

extern Mtime mtime;

void local_time_add_year(struct tm *time);
void local_time_add_month(struct tm *time);
void local_time_add_day(struct tm *time);
void local_time_add_hour(struct tm *time);
void local_time_add_min(struct tm *time);
uint32_t time_to_stamp(unsigned int year, unsigned int mon, unsigned int day, unsigned int hour, unsigned int min, unsigned int sec);
#endif